<template>
	<div class="bg-white">
		<div class="p-1 ">
			<h3>HI {{current.user.account}}</h3>
			<p class="text-secondary">欢迎使用戍码OA系统</p>
		</div>
		<div>
			<div v-for="(item, index) in neirong" :class="item.t =='ai' ? 'justify-content-start' : 'justify-content-end'" class="p-2 d-flex ">
				<span>
					<span v-if="item.t =='ai'">AI:</span>
					<span v-else>我:</span>
				{{item.msg}}</span>
			</div>
			<div class="p-2 d-flex justify-content-end">
				<Input class="w-50" v-model="msg"></Input>
				<Button @click="sendmessage">发送</Button>
			</div>
		</div>
	</div>
</template>
<script>
	export default {


		data() {
			return {
				setting: {
					
				},
				neirong: [],
				msg: "",
				
			}
		},

		computed: {
			current: function() {
				return this.store.state.currentUser;

			}
		},
		methods: {
			sendmessage: function() {
				let item = {};
				item.msg = this.msg;
				item.t = "wo";
				this.neirong.push(item);
				
				let ppp = {
						data: con => {
							let item = {};
							item.msg = con;
							item.t = "ai";
							this.neirong.push(item);
							
						}
					};
				ppp.param = this.msg.toString();
				this.msg = "";
				
				this.sse.connection(ppp);
			}
		},
		created: function() {
			
		},


	}
</script>

<style scoped>

</style>
